1. Field of the Invention
The present invention relates to the field of data processing, and more particularly, to the sharing of program code among virtual machines in a multi-tasking operating system environment.
2. Art Background
The Microsoft.TM. Windows version 3.1 operating system environment permits multi-tasking of program applications in an IBM.TM. compatible personal computer system. The Microsoft.TM. Windows V. 3.1 supports an enhanced mode. The Windows enhanced mode, in addition to the features found in the Windows standard mode, creates the use of disk operating system (DOS) virtual machines (VMs). Referring to FIG. 1, a memory map for a computer system configured for running Windows in enhanced mode is illustrated. The memory map 100 comprises a conventional memory area 110, ranging from 0 to 1.09 mega bytes (MB), and an extended memory area 125. Below 640 kilo bytes (KB) in the conventional memory area 110, resides an interrupt vector table 112, DOS files 114, device drivers 116, terminate and stay resident (TSR) programs 118, and an application area 120. In addition, a video area 122 and a system area 124 reside in an upper portion of the conventional memory area 110. In real mode, only the conventional memory area 110 is accessible to the computer system. The extended memory area 125 provides additional system memory for operation in protected mode.
The Windows enhanced mode utilizes a virtual 8086 mode on an Intel.TM. 80386 microprocessor to emulate a DOS environment for operation of each DOS VM. A first virtual machine holds Windows itself, all the Windows applications, and any DOS TSRs and device drivers which were started before Windows was loaded. This first virtual machine is known as the system virtual machine (system VM). The Windows enhanced mode supports a memory paging system which allows access to system memory up to 4 giga bytes (GB) for storing a number of DOS VMs and a system VM. The DOS VMs are limited to 1.09 MB of system memory. With the use of addition system memory, the Windows enhanced mode supports several DOS VMs concurrently. A VM is formed under protected mode; however, the VM consists of both real mode and protected mode code. The real mode portion of the DOS VM emulates an 8086 system. However, unlike the real mode 8086, the virtual 8086 mode access to all interrupts and hardware is virtualized. Windows creates DOS virtual machines using a combination of hardware support from the microprocessor and software support from the operating system.
To create a DOS VM to run a DOS application, Windows makes a virtual copy of the conventional memory area 110 memory below the 1 MB boundary of the system VM into a region of the extended memory 125. The copied region becomes the address space of a DOS virtual machine. The Windows software maps DOS, the device drivers, and all the TSRs programs of the original real mode memory area into the DOS VM address space. Finally, the processor enters Virtual 8086 mode of the Intel.TM. 386 or 486 processor and executes the copy of DOS in the virtual machine. Although a normal 8086 processor can only see the real mode memory below the 1 MB boundary, the 386 or 486 processor operating in Virtual 8086 mode uses the virtual memory feature to make the DOS VM in the extended memory appear to be real mode memory.
Although the Windows enhanced mode permits storage of a number of DOS VMs concurrently, each VM operates as a separate software entity. The DOS VMs access code and data located within the 1 MB portion of system memory allocated to that DOS VM or in the conventional memory area, also called a shared portion, of system memory. Consequently, any routine calling another routine in a particular DOS VM must either reside in that DOS VM or in the shared portion of system memory. In creating each DOS VM in the Windows enhanced mode, a virtual copy is made of the conventional memory area of the system memory. Therefore, all routines residing in the conventional memory area prior to the invocation of Windows is mapped to the same location within each DOS VM. If it is desirable for a number of DOS VMs to share a routine, the shared routine may be loaded into the conventional area of memory prior to loading Windows.
Although placing the shared routine in the conventional area of memory prior to loading Windows results in accessibility of the shared routine by all the DOS VMs, there are a number of undesirable consequences of storing the shared routine in the conventional area of memory. First, if a particular DOS VM does not use or need the shared routine, then the placement of the routine in the conventional area results in needless reduction of memory for that DOS VM. Second, as illustrated in FIG. 1, the shared portion of memory is limited, and if the routine is large, the amount of shared system memory is greatly reduced. Third, routines residing in the shared portion of memory generally must run in real mode. If the code is limited to operation in real mode, then the effectiveness of the routine may be reduced.
An alternative to storing the shared routine in the conventional area of memory is to load a copy of the shared routine in each VM. Because there is a separate version of the routine in each DOS VM, state information pertaining to the corresponding routine could not be coordinated among the various copies of the routine residing in the different DOS VMs.
As will be described, the present invention allows code sharing of routines among virtual machines running in the Windows operating system enhanced mode. A single copy of each routine resides in a target VM stored in an extended portion of the computer system memory. The routines are accessible by a DOS or Windows application, even if the calling application resides in a different VM.